package com.yida.gwj.deposit.controller;

import com.yida.common.core.constant.SecurityConstants;
import com.yida.common.core.text.Convert;
import com.yida.common.core.utils.DateUtils;
import com.yida.common.core.utils.StringUtils;
import com.yida.common.core.utils.poi.ExcelUtil;
import com.yida.common.core.web.controller.BaseController;
import com.yida.common.core.web.domain.AjaxResult;
import com.yida.common.core.web.page.TableDataInfo;
import com.yida.common.log.annotation.Log;
import com.yida.common.log.enums.BusinessType;
import com.yida.common.security.annotation.RequiresPermissions;
import com.yida.gwj.api.domain.GwjFinanceAccountMain;
import com.yida.gwj.api.domain.request.RemoteGwjFinanceAccountMainRequest;
import com.yida.gwj.api.service.RemoteGwjConfigService;
import com.yida.gwj.common.constant.GwjConstants;
import com.yida.gwj.common.domain.GwjBaseBuild;
import com.yida.gwj.common.domain.dto.GwjBusinessFlagDTO;
import com.yida.gwj.common.domain.dto.GwjBusinessStepDTO;
import com.yida.gwj.common.enums.GwjBusinessFlagType;
import com.yida.gwj.common.utils.GwjConvertUtil;
import com.yida.gwj.deposit.domain.GwjDepositBusiness;
import com.yida.gwj.deposit.domain.GwjDepositBusinessBuild;
import com.yida.gwj.deposit.domain.GwjDepositBusinessHouse;
import com.yida.gwj.deposit.domain.GwjDepositBusinessLog;
import com.yida.gwj.deposit.domain.dto.*;
import com.yida.gwj.deposit.domain.dto.split.GwjFundsSplitBusinessHouseDTO;
import com.yida.gwj.deposit.domain.request.*;
import com.yida.gwj.deposit.domain.request.split.GwjFundsSplitBusinessHouseRequest;
import com.yida.gwj.deposit.domain.vo.GwjDepositBusinessHouseExcelVo;
import com.yida.gwj.deposit.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Description 业务（单位批量缴费）Controller
 * @Author wws
 * @Date 2023-02-17
 */
@RestController
@RequestMapping("/unit-deposit")
@Api(tags = "单位批量缴费")
public class GwjUnitDepositBusinessController extends BaseController {

    @Autowired
    private IGwjUnitDepositBusinessService gwjUnitDepositBusinessService;

    @Autowired
    private IGwjFundsSplitBusinessService gwjFundsSplitBusinessService;

    @Autowired
    private IGwjDepositBusinessHouseService gwjDepositBusinessHouseService;

    @Autowired
    private IGwjDepositBusinessService gwjDepositBusinessService;

    @Autowired
    private IGwjDepositBusinessLogService gwjDepositBusinessLogService;

    @Autowired
    private IGwjOwnerDepositBusinessService gwjOwnerDepositBusinessService;

    @Autowired
    private RemoteGwjConfigService remoteGwjConfigService;


    @Autowired
    private IGwjDepositBusinessBuildService gwjDepositBusinessBuildService;


    /**
     * 查询业务（单位批量缴费）列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "分页查询", response = GwjDepositPageDTO.class)
    @RequiresPermissions("gwj:unit:deposit:list")
    public TableDataInfo list(GwjDepositBusiness gwjDepositBusiness) {
        return getDataTable(gwjUnitDepositBusinessService.getPage(gwjDepositBusiness));
    }

    /**
     * 业务（单位批量缴费）保存
     */
    @RequiresPermissions("gwj:unit:deposit:save")
    @PostMapping("/save")
    @ApiOperation("保存")
    @Log(title = "单位批量缴费-保存（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult save(@Validated @RequestBody GwjUnitDepositRequest gwjUnitDepositRequest) {
        return AjaxResult.success(gwjUnitDepositBusinessService.save(gwjUnitDepositRequest));
    }

    /**
     * 查询（单位批量缴费）资金分户房屋列表
     */
    @GetMapping("/getHouseDetailList")
    @ApiOperation(value = "查询资金分户房屋列表", response = GwjDepositBusinessHouseListDTO.class)
    public TableDataInfo getHouseDetailList(@Validated GwjDepositBusinessHouse gwjDepositBusinessHouse) {

        return gwjUnitDepositBusinessService.getHouseDetailList(gwjDepositBusinessHouse);
    }


    /**
     * 查询（单位批量缴费）资金分户房屋列表头部
     */
    @GetMapping("/getHouseDetailTop")
    @ApiOperation(value = "资金分户房屋列表头部", response = GwjDepositBusinessHouseTopDTO.class)
    public AjaxResult getHouseDetailTop(@Validated GwjDepositBusinessHouse gwjDepositBusinessHouse) {

        return AjaxResult.success(gwjUnitDepositBusinessService.getHouseDetailTop(gwjDepositBusinessHouse));
    }

    /**
     * 根据标准计算楼栋房屋
     */
    @RequiresPermissions("gwj:unit:deposit:calculate")
    @PostMapping("/calculateHouse")
    @ApiOperation("根据标准计算楼栋房屋")
    @Log(title = "单位批量缴费-资金分户-设置计算标准（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult calculateHouse(@RequestBody GwjCalculateRequest gwjCalculateRequest) {
        gwjUnitDepositBusinessService.calculateHouse(gwjCalculateRequest);
        return AjaxResult.success();
    }

    /**
     * 房屋维护-加入选择
     */
    @RequiresPermissions("gwj:unit:deposit:houseConfirm")
    @GetMapping("/houseMaintain/confirm/{bizId}/{bizHouseIds}")
    @ApiOperation("房屋维护加入选择")
    @Log(title = "单位批量缴费-房屋维护-加入选择（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult houseMaintainConfirmSelect(@PathVariable Long[] bizHouseIds, @PathVariable Long bizId) {
        gwjUnitDepositBusinessService.houseMaintainConfirmSelect(bizHouseIds, bizId);
        return AjaxResult.success();
    }

    /**
     * 房屋维护-取消选择
     */
    @RequiresPermissions("gwj:unit:deposit:houseCancel")
    @GetMapping("/houseMaintain/cancel/{bizId}/{bizHouseIds}")
    @ApiOperation("房屋维护取消选择")
    @Log(title = "单位批量缴费-房屋维护-取消选择（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult houseMaintainCancelSelect(@PathVariable Long[] bizHouseIds, @PathVariable Long bizId) {
        gwjUnitDepositBusinessService.houseMaintainCancelSelect(bizHouseIds, bizId);
        return AjaxResult.success();
    }

    /**
     * 创建公用户房屋
     */
    @RequiresPermissions("gwj:unit:deposit:createPublicHouse")
    @PostMapping("/publicHouse/create")
    @ApiOperation("创建公用户房屋")
    @Log(title = "单位批量缴费-资金分户-创建公用户房屋（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult publicHouseCreate(@RequestBody GwjPublicAccountRequest gwjPublicAccountRequest) {
        gwjUnitDepositBusinessService.createPublicHouse(gwjPublicAccountRequest);
        return AjaxResult.success();
    }


    /**
     * 编辑公用户房屋
     */
    @RequiresPermissions("gwj:unit:deposit:updatePublicHouse")
    @PutMapping("/publicHouse/update")
    @ApiOperation("编辑公用户房屋")
    @Log(title = "单位批量缴费-资金分户-编辑公用户房屋（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult updatePublicHouse(@RequestBody List<GwjPublicBusinessHouseRequest> houseRequests) {
        gwjUnitDepositBusinessService.updatePublicHouse(houseRequests);
        return AjaxResult.success();
    }

    /**
     * 删除公用户房屋
     */
    @RequiresPermissions("gwj:unit:deposit:deletePublicHouse")
    @GetMapping("/publicHouse/delete/{bizId}/{bizHouseIds}")
    @ApiOperation("删除公用户房屋")
    @Log(title = "单位批量缴费-资金分户-删除公用户房屋（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult deletePublicHouseDelete(@PathVariable Long bizId, @PathVariable Long[] bizHouseIds) {
        gwjUnitDepositBusinessService.deletePublicHouse(bizHouseIds, bizId);
        return AjaxResult.success();
    }

    /**
     * 导出房屋详情列表 含楼栋信名称、业主名称
     */
    @RequiresPermissions("gwj:unit:deposit:exportHouseInfo")
    @PostMapping("/exportHouseInfo")
    @ApiOperation(value = "导出房屋信息", produces = "application/octet-stream")
    @Log(title = "房屋信息-导出", businessType = BusinessType.EXPORT, systemName = "gwj")
    public void exportHouseInfo(HttpServletResponse response, @RequestBody GwjFundsSplitBusinessHouseRequest request) {
        if (StringUtils.isNotBlank(request.getBuildCodeStr())) {
            request.setBuildCodes(Convert.toStrArray(request.getBuildCodeStr()));
        }
        request.setPublicFlag(GwjConstants.NO);
        List<GwjFundsSplitBusinessHouseDTO> list = gwjDepositBusinessHouseService.selectGwjDepositBusinessHouseWithBuildNameList(request);
        ExcelUtil<GwjDepositBusinessHouseExcelVo> util = new ExcelUtil<>(GwjDepositBusinessHouseExcelVo.class);
        //查询业务编码
        GwjDepositBusiness gwjDepositBusiness = gwjDepositBusinessService.selectGwjDepositBusinessByBizId(request.getBizId());
        util.exportExcel(response, GwjConvertUtil.convertList(list, GwjDepositBusinessHouseExcelVo.class), gwjDepositBusiness.getBizNum() + "_" + DateUtils.dateTimeNow());
    }

    /**
     * 导入房屋信息
     */
    @RequiresPermissions("gwj:unit:deposit:importHouseInfo")
    @PostMapping("/importHouseInfo")
    @ApiOperation("导入房屋信息")
    @Log(title = "房屋信息-导入", businessType = BusinessType.IMPORT, systemName = "gwj")
    public AjaxResult importHouseInfo(@RequestPart("file") MultipartFile file, Long bizId) {
        return AjaxResult.success(gwjUnitDepositBusinessService.importHouseInfo(file,bizId));
    }


    /**
     * 删除楼栋
     */
    @RequiresPermissions("gwj:unit:deposit:deleteBuild")
    @DeleteMapping("/deleteBuildData/{bizId}/{bizBuildIds}")
    @ApiOperation("删除楼栋")
    @Log(title = "单位批量缴费-删除楼栋（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult deleteBuild(@PathVariable("bizId") Long bizId, @PathVariable("bizBuildIds") Long[] bizBuildIds) {
        gwjUnitDepositBusinessService.deleteBuildData(bizId, bizBuildIds);
        return AjaxResult.success();
    }

    /**
     * 查询缴存清册
     *
     * @param bizId 业务主键
     * @return
     */
    @GetMapping("/getDepositRecord/{bizId}")
    @ApiOperation(value = "查询缴存清册", response = GwjDepositBuildRecordDTO.class)
    public TableDataInfo getDepositRecord(@PathVariable("bizId") Long bizId) {
        return getDataTable(gwjUnitDepositBusinessService.getDepositRecord(bizId));
    }

    /**
     * 查询缴存清册头部
     *
     * @param bizId 业务主键
     * @return
     */
    @GetMapping("/getDepositRecordTop/{bizId}")
    @ApiOperation(value = "查询缴存清册头部", response = GwjDepositRecordDTO.class)
    public AjaxResult getDepositRecordTop(@PathVariable("bizId") Long bizId) {
        return AjaxResult.success(gwjUnitDepositBusinessService.getDepositRecordTop(bizId));
    }

    /**
     * 查询小区分户清册
     *
     * @param bizId 业务主键
     * @return
     */
    @GetMapping("/getHouseholdRecord/{bizId}")
    @ApiOperation(value = "查询小区分户清册", response = GwjCommunityHouseholdHouseRecordDTO.class)
    public TableDataInfo getCommunityHouseholdRecord(@PathVariable("bizId") Long bizId) {
        return getDataTable(gwjUnitDepositBusinessService.getCommunityHouseholdRecord(bizId));
    }

    /**
     * 查询小区分户清册头部
     *
     * @param bizId 业务主键
     * @return
     */
    @GetMapping("/getHouseholdRecordTop/{bizId}")
    @ApiOperation(value = "查询小区分户清册头部", response = GwjCommunityHouseholdRecordTopDTO.class)
    public AjaxResult getCommunityHouseholdRecordTop(@PathVariable("bizId") Long bizId) {
        return AjaxResult.success(gwjUnitDepositBusinessService.getCommunityHouseholdRecordTop(bizId));
    }

    /**
     * 查询业务（基础数据管理模块）列表
     */
    @GetMapping("/info")
    @ApiOperation(("查询业务流程"))
    public AjaxResult getBusinessInfo() {
        AjaxResult ajax = AjaxResult.success();
        ajax.put("bizFlag", GwjConvertUtil.convert(remoteGwjConfigService.selectGwjConfBusinessFlagByBizFlagId(GwjBusinessFlagType.UNIT_DEPOSIT.getCode(), SecurityConstants.INNER).getData(), GwjBusinessFlagDTO.class));
        List<GwjBusinessStepDTO> steps = GwjConvertUtil.convertList(remoteGwjConfigService.selectGwjConfStepListByFlagId(GwjBusinessFlagType.UNIT_DEPOSIT.getCode(), SecurityConstants.INNER).getData(), GwjBusinessStepDTO.class);
        steps.forEach(stepDTO -> stepDTO.setConfigs(remoteGwjConfigService.selectGwjConfStepConfigInfoCodeListByBizFlagId(stepDTO.getStepId(), SecurityConstants.INNER).getData()));
        ajax.put("steps", steps);
        return ajax;
    }

    /**
     * 查看业务日志
     */
    @ApiOperation(value = "查看业务日志", response = GwjDepositBusinessLog.class)
    @GetMapping("/log/{bizId}")
    public AjaxResult log(@PathVariable Long bizId) {
        return AjaxResult.success(GwjConvertUtil.convertList(gwjDepositBusinessLogService.selectGwjDepositBusinessLogListByBizId(bizId), GwjBusinessLogDTO.class));
    }

    /**
     * 签署意见
     */
    @RequiresPermissions("gwj:unit:deposit:signOpinion")
    @ApiOperation(value = "签署意见")
    @PostMapping("/signOpinion")
    @Log(title = "单位批量缴费-签署意见（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult signOpinion(@Validated(GwjDepositBusinessLog.Sign.class) @RequestBody GwjDepositBusinessLog businessLog) {
        gwjUnitDepositBusinessService.signOpinion(businessLog);
        return AjaxResult.success();
    }

    /**
     * 送件
     */
    @RequiresPermissions("gwj:unit:deposit:send")
    @ApiOperation(value = "送件")
    @PostMapping("/send")
    @Log(title = "单位批量缴费-送件（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult sendBusiness(@Validated(GwjDepositBusinessLog.Send.class) @RequestBody GwjDepositBusinessLog businessLog) {
        gwjUnitDepositBusinessService.send(businessLog);
        return AjaxResult.success();
    }

    /**
     * 提交
     */
    @RequiresPermissions("gwj:unit:deposit:submit")
    @ApiOperation("提交")
    @PostMapping("/submitBusiness")
    @Log(title = "单位批量缴费-提交（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult submitBusiness(@Validated @RequestBody GwjUnitDepositSubmitRequest submitRequest) {
        gwjUnitDepositBusinessService.submitBusiness(submitRequest);
        return AjaxResult.success();
    }

    /**
     * 回退
     */
    @RequiresPermissions("gwj:unit:deposit:fallback")
    @ApiOperation(value = "回退")
    @DeleteMapping("/fallback")
    @Log(title = "单位批量缴费-回退（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult fallback(@Validated(GwjDepositBusinessLog.Fallback.class) @RequestBody GwjDepositBusinessLog businessLog) {
        gwjUnitDepositBusinessService.fallback(businessLog);
        return AjaxResult.success();
    }

    /**
     * 删页
     */
    @RequiresPermissions("gwj:unit:deposit:deleteBusinessData")
    @DeleteMapping("/deleteBusinessData/{bizId}")
    @ApiOperation("删页")
    @Log(title = "单位批量缴费-删页（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult deleteBusinessData(@PathVariable Long bizId) {
        gwjUnitDepositBusinessService.deleteBusinessData(bizId);
        return AjaxResult.success();
    }

    /**
     * 业务作废
     */
    @RequiresPermissions("gwj:unit:deposit:invalid")
    @DeleteMapping("/invalidBusiness")
    @ApiOperation("业务作废")
    @Log(title = "单位批量缴费（初始化）-业务作废（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult invalidBusiness(@Validated(GwjDepositBusinessLog.Cancellation.class) @RequestBody GwjDepositBusinessLog gwjDepositBusinessLog) {
        gwjDepositBusinessService.invalidBusiness(gwjDepositBusinessLog);
        return AjaxResult.success();
    }

    /**
     * 业务修改
     */
    @RequiresPermissions("gwj:unit:deposit:edit")
    @PutMapping("/editBusiness")
    @ApiOperation("业务修改")
    @Log(title = "单位批量缴费-业务修改（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult editBusiness(@Validated @RequestBody GwjUnitDepositEditRequest editRequest) {
        gwjUnitDepositBusinessService.editBusiness(editRequest);
        return AjaxResult.success();
    }

    /**
     * 查询基础楼栋信息
     */
    @GetMapping("/getBaseBuildInfo/{communityId}")
    @ApiOperation(value = "查询基础楼栋信息", response = GwjBaseBuild.class)
    public TableDataInfo getGwjBaseBuildDetailList(@PathVariable("communityId") Long communityId) {
        return getDataTable(gwjUnitDepositBusinessService.getGwjBaseBuildDetailList(communityId));
    }

    /**
     * 选择楼栋
     */
    @RequiresPermissions("gwj:unit:deposit:chooseBaseBuild")
    @GetMapping("/chooseBaseBuild/{bizId}/{buildIds}")
    @ApiOperation("选择楼栋")
    @Log(title = "单位批量缴费-选择楼栋（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult chooseBaseBuild(@PathVariable("bizId") Long bizId, @PathVariable("buildIds") Long[] buildIds) {
        gwjUnitDepositBusinessService.chooseBaseBuild(bizId, buildIds);
        return AjaxResult.success();
    }


    /**
     * 财务对账
     */
    @RequiresPermissions("gwj:unit:deposit:financeCheck")
    @GetMapping("/financeCheck/{bizId}")
    @ApiOperation("财务对账")
    @Log(title = "单位批量缴费-财务对账（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult financeCheck(@PathVariable("bizId") Long bizId) {
        gwjUnitDepositBusinessService.financeCheck(bizId);
        return AjaxResult.success();
    }

    /**
     * 业务详情
     */
    @GetMapping("/getDetail/{bizId}")
    @ApiOperation(value = "查询业务详情", response = GwjUnitDepositDetailDTO.class)
    public AjaxResult getDetail(@PathVariable("bizId") Long bizId) {
        return AjaxResult.success(gwjUnitDepositBusinessService.getDetail(bizId));
    }

    /**
     * 删除案例
     */
    @RequiresPermissions("gwj:unit:deposit:remove")
    @DeleteMapping("/removeBusiness/bizId")
    @ApiOperation("删除案例")
    @Log(title = "单位批量缴费-删除案例（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult removeBusiness(@PathVariable("bizId") Long bizId) {
        return AjaxResult.success(gwjUnitDepositBusinessService.removeBusiness(bizId));
    }


    /**
     * 查询业务总账详情
     */
    @GetMapping("/getAccountDetail/{bizId}")
    @ApiOperation(value = "查询总账", response = GwjFinanceAccountMain.class)
    public TableDataInfo getAccountMain(@Validated RemoteGwjFinanceAccountMainRequest mainRequest) {
        return gwjDepositBusinessService.selectGwjFinanceAccountMainList(mainRequest);
    }

    /**
     * 资金分户修改房屋缴费面积
     */
    @RequiresPermissions("gwj:unit:deposit:editCalculateHouse")
    @PutMapping("/editCalculateHouse")
    @ApiOperation("资金分户修改房屋缴费面积")
    @Log(title = "单位批量缴费-资金分户修改房屋缴费面积（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult editCalculateHouse(@Validated @RequestBody GwjUnitDepositEditCalculateHouseRequest calculateHouseRequest) {
        gwjUnitDepositBusinessService.editCalculateHouse(calculateHouseRequest);
        return AjaxResult.success();
    }

    /**
     * 修改业务小区与楼栋信息
     */
    @RequiresPermissions("gwj:unit:deposit:edit")
    @PutMapping("/editCommunityAndBuild")
    @ApiOperation("修改业务小区信息")
    @Log(title = "单位批量缴费-修改业务小区信息（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult editCommunityAndBuild(@Validated @RequestBody GwjUnitDepositCommunityAndBuildEditRequest editRequest){
        gwjUnitDepositBusinessService.editCommunityAndBuild(editRequest);
        return AjaxResult.success();
    }

    /**
     *  修改业务金额缴费标准
     */
    @RequiresPermissions("gwj:unit:deposit:edit")
    @PutMapping("/editMoneyCalculate")
    @ApiOperation("修改业务金额缴费标准")
    @Log(title = "单位批量缴费-修改业务金额缴费标准（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult editMoneyCalculate(@Validated @RequestBody GwjUnitDepositEditMoneyCalculateRequest calculateRequest){
        gwjUnitDepositBusinessService.editMoneyCalculate(calculateRequest);
        return AjaxResult.success();
    }

    /**
     *  修改业务楼栋
     */
    @RequiresPermissions("gwj:unit:deposit:edit")
    @PutMapping("/editBuildCalculateAndBuildType")
    @ApiOperation("修改业务楼栋")
    @Log(title = "单位批量缴费-修改业务楼栋（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult editBuildCalculateAndBuildType(@Validated @RequestBody GwjUnitDepositEditBuildCalculateRequest calculateRequest){
        gwjUnitDepositBusinessService.editBuildCalculateAndBuildType(calculateRequest);
        return AjaxResult.success();
    }

    /**
     *  公用户楼栋列表
     */
    @GetMapping("/publicBuild/list/{bizId}")
    @ApiOperation("公用户楼栋列表")
    public AjaxResult publicBuildList(@PathVariable Long bizId) {
        GwjDepositBusinessBuild gwjDepositBusinessBuild = new GwjDepositBusinessBuild();
        gwjDepositBusinessBuild.setBizId(bizId);
        gwjDepositBusinessBuild.setPublicFlag(GwjConstants.YES);
        return AjaxResult.success(GwjConvertUtil.convertList(gwjDepositBusinessBuildService.selectGwjDepositBusinessBuildList(gwjDepositBusinessBuild), GwjPublicBusinessBuildDTO.class));
    }

    /**
     *  创建公用户楼栋
     */
    @PostMapping("/publicBuild/create")
    @Log(title = "单位批量缴费-资金分户-创建公用户楼栋（缴存业务管理模块）", systemName = "gwj")
    @ApiOperation("创建公用户楼栋")
    public AjaxResult publicBuildCreate(@RequestBody GwjPublicAccountRequest gwjPublicAccountRequest) {
        gwjUnitDepositBusinessService.createPublicBuild(gwjPublicAccountRequest);
        return AjaxResult.success();
    }

    /**
     *  编辑公用户楼栋
     */
    @PutMapping("/publicBuild/update/{bizId}")
    @Log(title = "单位批量缴费-资金分户-编辑公用户楼栋（缴存业务管理模块）", systemName = "gwj")
    @ApiOperation("编辑公用户楼栋")
    public AjaxResult updatePublicBuild(@PathVariable Long bizId, @RequestBody List<GwjPublicBusinessBuildRequest> gwjDepositBusinessBuilds) {
        //验证是否有操作权限
        gwjDepositBusinessService.checkPermission(bizId);
        if (StringUtils.isNotEmpty(gwjDepositBusinessBuilds)) {
            gwjDepositBusinessBuildService.updateBatchGwjDepositBusinessBuild(GwjConvertUtil.convertList(gwjDepositBusinessBuilds, GwjDepositBusinessBuild.class));
        }
        return AjaxResult.success();
    }

    /**
     *  删除公用户楼栋
     */
    @GetMapping("/publicBuild/delete/{bizId}/{bizBuildIds}")
    @ApiOperation("删除公用户楼栋")
    @Log(title = "单位批量缴费-资金分户-删除公用户楼栋（缴存业务管理模块）", systemName = "gwj")
    public AjaxResult deletePublicBuildDelete(@PathVariable Long bizId, @PathVariable Long[] bizBuildIds) {
        gwjFundsSplitBusinessService.deletePublicBuild(bizBuildIds, bizId);
        return AjaxResult.success();
    }

}
